package com.wyzz.hr.pojo;

import com.wyzz.hr.bo.IEmployeeBo;
import com.wyzz.hr.pojo.base.BaseEmployee;
import com.wyzz.hr.spring.SpringBeanFactory;

import java.util.*;

public class Employee extends BaseEmployee implements Cloneable {

	public Employee() {
		ssNameList = new ArrayList();
		syncResult = Integer.valueOf(0);
	}

	public String getIds() {
		return ids;
	}

	public void setIds(String ids) {
		this.ids = ids;
	}

	public Employee(String id) {
		super(id);
		ssNameList = new ArrayList();
		syncResult = Integer.valueOf(0);
	}

	public Employee(String id, String empDistinctNo, Integer empMachineNo,
			Emptype empType, Department empDeptNo, String empName,
			Date empJoinDate, Integer empStatus, Integer empGender,
			Integer empIdentificationType, String empIdentificationNo,
			Date empBirthDate, Date empCreateTime, Date empLastChangeTime) {
		super(id, empDistinctNo, empMachineNo, empType, empDeptNo, empName,
				empJoinDate, empStatus, empGender, empIdentificationType,
				empIdentificationNo, empBirthDate, empCreateTime,
				empLastChangeTime);
		ssNameList = new ArrayList();
		syncResult = Integer.valueOf(0);
	}

	public String[] getOrgInCharge() {
		if (getId() == null)
			return null;
		IEmployeeBo empBo = (IEmployeeBo) SpringBeanFactory.getBean("empBo");
		String hql = (new StringBuilder()).append(
				"SELECT orgheadsOrgNo from Orgheads where orgheadsEmpNo ='")
				.append(getId()).append("'").toString();
		List list = empBo.exeHqlList(hql, new int[0]);
		if (list == null || list.size() == 0)
			return null;
		else
			return (String[]) (String[]) list.toArray(new String[list.size()]);
	}

	/**
	 * @deprecated Method getDeptInChargeOld is deprecated
	 */

	public String[] getDeptInChargeOld() {
		if (getId() == null)
			return null;
		IEmployeeBo empBo = (IEmployeeBo) SpringBeanFactory.getBean("empBo");
		String hql = (new StringBuilder())
				.append(
						"SELECT orgheadsOrgNo from Orgheads where orgheadsResponsibility like 'dept%' and orgheadsEmpNo ='")
				.append(getId()).append("'").toString();
		List list = empBo.exeHqlList(hql, new int[0]);
		if (list == null || list.size() == 0)
			return null;
		else
			return (String[]) (String[]) list.toArray(new String[list.size()]);
	}

	public String[] getAreaInCharge() {
		if (getId() == null)
			return null;
		IEmployeeBo empBo = (IEmployeeBo) SpringBeanFactory.getBean("empBo");
		String hql = (new StringBuilder())
				.append(
						"SELECT orgheadsOrgNo from Orgheads where orgheadsResponsibility like 'area%' and  orgheadsEmpNo='")
				.append(getId()).append("'").toString();
		List list = empBo.exeHqlList(hql, new int[0]);
		if (list == null || list.size() == 0)
			return null;
		else
			return (String[]) (String[]) list.toArray(new String[list.size()]);
	}

	public String[] getGroupInCharge() {
		if (getId() == null)
			return null;
		IEmployeeBo empBo = (IEmployeeBo) SpringBeanFactory.getBean("empBo");
		String hql = (new StringBuilder())
				.append(
						"SELECT orgheadsOrgNo from Orgheads where orgheadsResponsibility like 'grp%' and  orgheadsEmpNo='")
				.append(getId()).append("'").toString();
		List list = empBo.exeHqlList(hql, new int[0]);
		if (list == null || list.size() == 0)
			return null;
		else
			return (String[]) (String[]) list.toArray(new String[list.size()]);
	}

	public String[] getBuInCharge() {
		if (getId() == null)
			return null;
		IEmployeeBo empBo = (IEmployeeBo) SpringBeanFactory.getBean("empBo");
		String hql = (new StringBuilder())
				.append(
						"SELECT orgheadsOrgNo from Orgheads where orgheadsResponsibility like 'bu%' and orgheadsEmpNo ='")
				.append(getId()).append("'").toString();
		List list = empBo.exeHqlList(hql, new int[0]);
		if (list == null || list.size() == 0)
			return null;
		else
			return (String[]) (String[]) list.toArray(new String[list.size()]);
	}

	public String[] getBranchInCharge() {
		if (getId() == null)
			return null;
		IEmployeeBo empBo = (IEmployeeBo) SpringBeanFactory.getBean("empBo");
		String hql = (new StringBuilder())
				.append(
						"SELECT orgheadsOrgNo from Orgheads where orgheadsResponsibility like 'bra%' and orgheadsEmpNo ='")
				.append(getId()).append("'").toString();
		List list = empBo.exeHqlList(hql, new int[0]);
		if (list == null || list.size() == 0)
			return null;
		else
			return (String[]) (String[]) list.toArray(new String[list.size()]);
	}

	public String getDeptNo() {
		return deptNo;
	}

	public void setDeptNo(String deptNo) {
		this.deptNo = deptNo;
	}

	public String getJobTitle() {
		if (jobTitle != null && jobTitle.length() > 0)
			return jobTitle.trim();
		else
			return jobTitle;
	}

	public void setJobTitle(String jobTitle) {
		this.jobTitle = jobTitle;
	}

	public String getManager() {
		return manager;
	}

	public void setManager(String manager) {
		this.manager = manager;
	}

	public int getChanged() {
		return changed;
	}

	public void setChanged(int changed) {
		this.changed = changed;
	}

	public String getChangeDate() {
		return changeDate;
	}

	public void setChangeDate(String changeDate) {
		this.changeDate = changeDate;
	}

	public String getChangeReason() {
		return changeReason;
	}

	public void setChangeReason(String changeReason) {
		this.changeReason = changeReason;
	}

	public String getNewStatus() {
		return newStatus;
	}

	public void setNewStatus(String newStatus) {
		this.newStatus = newStatus;
	}

	public String getEmpSupName() {
		return empSupName;
	}

	public void setEmpSupName(String empSupName) {
		this.empSupName = empSupName;
	}

	public String getEmpNoName() {
		return empNoName;
	}

	public void setEmpNoName(String empNoName) {
		this.empNoName = empNoName;
	}

	public List getLogs() {
		return logs;
	}

	public void setLogs(List logs) {
		this.logs = logs;
	}

	public String getLocationNo() {
		return locationNo;
	}

	public void setLocationNo(String locationNo) {
		this.locationNo = locationNo;
	}

	public String getTypeNo() {
		return typeNo;
	}

	public void setTypeNo(String typeNo) {
		this.typeNo = typeNo;
	}

	public Empsalarypay getEmpsalarypay() {
		return empsalarypay;
	}

	public void setEmpsalarypay(Empsalarypay empsalarypay) {
		this.empsalarypay = empsalarypay;
	}

	public boolean isHasApproveAuth() {
		return hasApproveAuth;
	}

	public void setHasApproveAuth(boolean hasApproveAuth) {
		this.hasApproveAuth = hasApproveAuth;
	}

	public String[] getEmpInCharge() {
		return empInCharge;
	}

	public void setEmpInCharge(String empInCharge[]) {
		this.empInCharge = empInCharge;
	}

	public Float getJoinYear() {
		return joinYear;
	}

	public void setJoinYear(Float joinYear) {
		this.joinYear = joinYear;
	}

	public Float getPracticeMonth() {
		return practiceMonth;
	}

	public void setPracticeMonth(Float practiceMonth) {
		this.practiceMonth = practiceMonth;
	}

	public Date getConfirmDate() {
		return confirmDate;
	}

	public void setConfirmDate(Date confirmDate) {
		this.confirmDate = confirmDate;
	}

	public Date getJoinDate() {
		return joinDate;
	}

	public void setJoinDate(Date joinDate) {
		this.joinDate = joinDate;
	}

	public Date getBirthDate() {
		return birthDate;
	}

	public void setBirthDate(Date birthDate) {
		this.birthDate = birthDate;
	}

	public Date getWorkDate() {
		return workDate;
	}

	public void setWorkDate(Date workDate) {
		this.workDate = workDate;
	}

	public String getYearOrMonth(Float joinYear) {
		int value = 0;
		String result = "";
		if (joinYear.floatValue() >= 1.0F) {
			value = Integer.parseInt((new StringBuilder()).append(
					joinYear.intValue()).append("").toString());
			result = (new StringBuilder()).append(result).append(value).append(
					"\u5E74").toString();
		} else {
			joinYear = Float.valueOf(joinYear.floatValue() * 100F);
			value = Integer.parseInt((new StringBuilder()).append(
					joinYear.intValue()).append("").toString());
			result = (new StringBuilder()).append(result).append(value).append(
					"\u4E2A\u6708").toString();
		}
		return result;
	}

	public Float getWorkYear() {
		return workYear;
	}

	public void setWorkYear(Float workYear) {
		this.workYear = workYear;
	}

	public String getCostCenter() {
		return costCenter;
	}

	public void setCostCenter(String costCenter) {
		this.costCenter = costCenter;
	}

	public List getSsNameList() {
		return ssNameList;
	}

	public void setSsNameList(List ssNameList) {
		this.ssNameList = ssNameList;
	}

	public String getEnglishName() {
		String first = getEmpFname() != null ? getEmpFname() : "";
		String middle = getEmpMname() != null ? getEmpMname() : "";
		String last = getEmpLname() != null ? getEmpLname() : "";
		return (new StringBuilder()).append(first).append(" ").append(middle)
				.append(" ").append(last).toString();
	}

	public void setEnglishName(String englishName) {
		this.englishName = englishName;
	}

	public Leavebalance getLeaveBalance() {
		return leaveBalance;
	}

	public void setLeaveBalance(Leavebalance leaveBalance) {
		this.leaveBalance = leaveBalance;
	}

	public Position getPosition() {
		return position;
	}

	public void setPosition(Position position) {
		this.position = position;
	}

	public Department getEmpBranch() {
		return empBranch;
	}

	public void setEmpBranch(Department empBranch) {
		this.empBranch = empBranch;
	}

	public Department getEmpDeptNo1() {
		return empDeptNo1;
	}

	public void setEmpDeptNo1(Department empDeptNo1) {
		this.empDeptNo1 = empDeptNo1;
	}

	public Department getEmpDeptNo2() {
		return empDeptNo2;
	}

	public void setEmpDeptNo2(Department empDeptNo2) {
		this.empDeptNo2 = empDeptNo2;
	}

	public Department getEmpDeptNo3() {
		return empDeptNo3;
	}

	public void setEmpDeptNo3(Department empDeptNo3) {
		this.empDeptNo3 = empDeptNo3;
	}

	public Integer getSyncResult() {
		return syncResult;
	}

	public void setSyncResult(Integer syncResult) {
		this.syncResult = syncResult;
	}

	public Department getEmpDeptNo4() {
		return empDeptNo4;
	}

	public void setEmpDeptNo4(Department empDeptNo4) {
		this.empDeptNo4 = empDeptNo4;
	}

	public Department getEmpDeptNo5() {
		return empDeptNo5;
	}

	public void setEmpDeptNo5(Department empDeptNo5) {
		this.empDeptNo5 = empDeptNo5;
	}

	public Employee getEmpSupNo() {
		return empSupNo;
	}

	public void setEmpSupNo(Employee empSupNo) {
		this.empSupNo = empSupNo;
	}

	public Employee clo() {
		Object obj = null;
		try {
			obj = super.clone();
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return (Employee) obj;
	}

	public Object clone() throws CloneNotSupportedException {
		return clo();
	}

	private static final long serialVersionUID = 1L;
	private Department empBranch;
	private Department empDeptNo1;
	private Department empDeptNo2;
	private Department empDeptNo3;
	private Department empDeptNo4;
	private Department empDeptNo5;
	private Employee empSupNo;
	private String empNoName;
	private String deptNo;
	private String manager;
	private String jobTitle;
	private String ids;
	private String empSupName;
	private String newStatus;
	private String changeReason;
	private String changeDate;
	private int changed;
	private String locationNo;
	private String typeNo;
	private Empsalarypay empsalarypay;
	private List logs;
	private String empInCharge[];
	private boolean hasApproveAuth;
	private Float joinYear;
	private Float practiceMonth;
	private Date workDate;
	private Date joinDate;
	private Date confirmDate;
	private Date birthDate;
	private Float workYear;
	private String costCenter;
	public String englishName;
	private List ssNameList;
	private Leavebalance leaveBalance;
	private Position position;
	private Integer syncResult;
}
